<?php

define('INCLUDE_CHECK',true);
require 'connect.php';

session_name('tzLogin'); 
session_start(); 
                    
                       $query = mysql_query(sprintf("SELECT doc_name, doc_id, date_created, date_updated FROM documents WHERE user_id = %d ORDER BY date_updated DESC", $_SESSION['id']));
                       while($nt=mysql_fetch_array($query))
                       {
                           $date_created=date("Y-m-d G:i:s",strtotime($nt[date_created]));
                           $date_updated=date("Y-m-d G:i:s",strtotime($nt[date_updated]));
                           echo "<div class='docWrapper'> 
                                     <div class='docDetails'> 
                                        <p> 
                                           name: 
                                           <span class='bold'>$nt[doc_name]</span>
                                           <br> 
                                           created: 
                                           <span class='timeago' title='$date_created'></span>
                                           <br>
                                           updated: 
                                           <span class='timeago' title='$date_updated'></span> 
                                        </p> 
                                      </div>
                                      <div class='buttonSpace'> 
                                        <a class='SE_buttonLink greenBg' href='/indstudy/editor.php?doc_id=$nt[doc_id]'>edit</a>
                                        <button name='renameButton' class='renameButtonClass grayBg' doc_id='$nt[doc_id]'>Rename</button>
                                        <button name='deleteButton' class='deleteButtonClass redBg' doc_id='$nt[doc_id]'>Delete</button> 
                                        <br> 
                                      </div>
                                   </div>
                                    <hr width='100%' color='#15ADFF' size='1'></hr>"; 
		       }
?>
